<template>
	<view class="page">
		<!-- 头部 start -->
		<view class="cu-custom bg-white   " :style="[{ height: CustomBar + 'px'}]">
			<view class="cu-bar bg-top fixed bg-white"
				:style="[{ height: CustomBar + 'px', paddingTop: StatusBar + 'px' }]">
				<view class="margin-left width-160 text-left" @tap="back"><text class="cuIcon-back"></text></view>
				<view class="">退款</view>
				<view class="right margin-right text-right width-160">
				</view>
			</view>
		</view>
		<!-- 头部 end -->
		<!-- 筛选 -->
		<!-- loading组件 -->
		<fu-loading v-if="isShowLoading"></fu-loading>
		<block v-else>
			<!--商品列表 start-->
			<view class=" padding-lr-24 relative  margin-top-sm">
				<view class=" w100">
					<view class="flex align-center margin-bottom-sm bg-white padding-sm radius-16"
						v-for="(item, index) in cateLists" :key="index" @tap='toDetail(item)'>
						<view class="w100">
							<view class="text-333">
								退款编号：{{item.server_no}}
							</view>
							<view class="flex align-center solid-bottom relative  padding-tb justify-between">
								<view class="flex align-center text-df">
									<view class="text-333 ">退款金额：<text class="text-prices">￥{{item.refund_money}}</text> </view>
								</view>
								<view class="text-999 text-sm">退款数量：<text class="text-prices">{{item.num}}</text> </view>
							</view>
							<view class="flex justify-end text-999 text-sm margin-top algin-center">
								{{item.create_time}}
							</view>
						</view>
					</view>
				</view>

			</view>
			<!-- 空布局 -->
			<fu-empty-ui v-if="cateLists.length == 0 "></fu-empty-ui>
		</block>
		<!-- 库存输入弹框 -->
		<fu-popup v-model="isShowCate" mode="center" border-radius="16" :mask-close-able="false">
			<view class="bg-white width-560">
				<view class="text-center padding text-lg text-333">{{pageType=='goods'?'添加商品参数':'添加包装清单'}}</view>
				<view class="padding-lr padding-bottom">
					<view class="  text-df text-333">标题</view>
					<view class="bg-f8 radius-8 padding-sm text-df margin-top">
						<input type="text" maxlength="10" placeholder="请输入标题名称" v-model="cateName"
							placeholder-class="text-df text-999">
					</view>
				</view>
				<view class="padding-lr padding-bottom">
					<view class="  text-df text-333">内容</view>
					<view class="bg-f8 radius-8 padding-sm text-df margin-top">
						<input type="text" maxlength="10" placeholder="请输入内容" v-model="cateName"
							placeholder-class="text-df text-999">
					</view>
				</view>
				<view class="foot solid-top flex align-center justify-between height-100">
					<view class="flex-sub text-gray solid-right text-center" @click="isShowCate=false">取消</view>
					<view class="flex-sub text-theme text-center" @click="handleConfirm">确定</view>
				</view>
			</view>
		</fu-popup>

		<!-- 断网检测组件 -->
		<fu-notwork></fu-notwork>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cateLists: [],
				isShowCate: false,
				cateName: '',
				isOpen: false,
				type: '', //弹框类型
				addType: '', //添加类型 child 子类
				editType: '', //添加类型 child 子类
				isShowLoading: false,
				pageType: '', //goods 商品参数  list 清单
				goods_id:'',//
				order_sn:'',//

			};
		},
		onLoad(e) {
			this.pageType = e.pageType
			this.goods_id=e.goods_id
			this.order_sn=e.order_sn
			this.getCate()
		},
		onShow() {

		},
		onUnload() {

		},
		onHide() {
			let data={}
			if(this.pageType=='goods'){
				uni.$emit('goodsInfo',data)
			}else{
				uni.$emit('packInfo',data)
			}
		},
		methods: {
			toDetail(item){
				this.$urouter.navigateTo({
					url: './refundDetail',
					params: {
						id:item.id
					}
				});
			},
			back() {
				uni.navigateBack()
			},
			addPop(type) {
				this.isShowCate = true
			},
			
			handleConfirm() {
				this.isShowCate = false
			},
			
			getCate() {
				this.$api
					.post('/v1/63e0d33a4db60', {
						goods_id:this.goods_id,
						order_sn:this.order_sn
					})
					.then(res => {
						this.isShowLoading = false;
						if (res.data.code == 1) {
							this.cateLists = res.data.data.data
						} else {
							this.$message.error(res.data.msg);
						}
					})
					.catch(err => {
						this.isShowLoading = false;
					});
			},
		},

	}
</script>

<style>
	.hiddenBox {
		position: absolute;
		top: 62rpx;
		right: 0;
		width: 160rpx;
		z-index: 199;
	}

	.hiddenText {
		position: absolute;
		top: 62rpx;
		right: 0;
		width: 160rpx;
		z-index: 299;
	}
</style>
